<template>
    <div>

        账号：<el-input v-model="user.username" clearable style="width: 200px" placeholder="账号"></el-input>
        <br>
        密码：<el-input v-model="user.password" show-password clearable style="width: 200px" placeholder="账号"></el-input>


        <br>
        <el-button @click="login">登录</el-button>


    </div>
</template>

<script>
    export default {
        name: "login",
        data(){
            return {
                user:{
                    username:"",
                    password:""
                }

            }
        },
        methods:{
            login(){
                this.axios.post("/sushelogin/user/login",this.user).then(res=>{

                    let myresult = res.data;

                    if(myresult.code==1){
                        let user = myresult.data;
                        localStorage.setItem("sushe_user",JSON.stringify(user));
                        this.$router.push("/count")
                    }else{
                        this.$message.error(myresult.message);
                    }

                })
            }
        }
    }
</script>

<style scoped>

</style>
